package org.example.finalsecurities.mapper;

import org.apache.ibatis.annotations.*;
import org.example.finalsecurities.entity.NewStockCalendarInfo;

import java.util.List;

/**
 * 新股上市日历Mapper接口
 *
 * @author : [Pahsm]
 * @version : [v1.0]
 */
@Mapper
public interface CalendarMapper {

    @Select("select abbreviation, release_date from t_listing_calendar")
    List<NewStockCalendarInfo> selectAll();

    @Insert("insert into t_listing_calendar (abbreviation, release_date, create_time, update_time) " +
            "values ( #{abbreviation}, #{releaseDate}, #{createTime}, #{updateTime})")
    Integer insert(NewStockCalendarInfo newStockCalendarInfo);

    @Update("update t_listing_calendar set abbreviation = #{abbreviation}," +
            "release_date = #{releaseDate} where id = #{id}")
    Integer updateById(NewStockCalendarInfo newStockCalendarInfo);

    @Select("select abbreviation, release_date from t_listing_calendar where id = #{id}")
    NewStockCalendarInfo selectById(Integer id);
    @Delete("delete from t_listing_calendar")
    Integer delete();
}
